// const obj = {
//   name: "frank",
//   age: 18,
//   height: 1.88,
// };

// const entries = Object.entries(obj);
// console.log(entries);

// const newObj = {};
// for (const item of entries) {
//   newObj[item[0]] = item[1];
// }

// 1.ES10中新增了Object.fromEntries方法
// const newObj = Object.fromEntries(entries);
// console.log(newObj);

// 2. 应用场景
const queryString = "name=why&age=18&height=1.88";
const queryParams = new URLSearchParams(queryString);
for (const param of queryParams) {
  console.log(param);
}
const paramObj = Object.fromEntries(queryParams);
console.log(paramObj);
